/*****************************************************************************
 *
 * Copyright (c), 2004-2020,ShangHai Neotune Information Technology Co., Ltd.
 *
 * Module Name : buildpkt.h
 *
 * Author :    sean
 *
 * Date :    2004-02-05
 *
 * Version :    1.00
 * 
 * Description :    
 *
 * Other :    
 *
 * Data Structure List: <Main Data Structure>
 *
 * Modification History
 * ---------------------------------------------------------------------------
 *  1: Data :      2004-02-05
 *    Author :     sean
 *    Version :    V100R001M00
 *    Modification : creation
 *
*****************************************************************************/

#if (!defined(buildpkt_inc))
#define buildpkt_inc

#ifdef __cplusplus
extern"C" {
#endif

#if (!defined(asn1conf_inc))
#include "asn1conf.h"
#endif

#if (!defined(asn1_inc))
#include "asn1.h"
#endif

#if (!defined(snmp_inc))
#include "snmp.h"
#endif

#if (!defined(snmpdefs_inc))
#include "snmpdefs.h"
#endif

#define SNMP_Bind_Counter(P,I,C,L,V)    SNMP_Bind_Unsigned_Integer(P, I, C, \
                                                        L, VT_COUNTER, V)

#define SNMP_Bind_Gauge(P,I,C,L,V)      SNMP_Bind_Unsigned_Integer(P, I, C, \
                                                        L, VT_GAUGE, V)

#define SNMP_Bind_Timeticks(P,I,C,L,V)  SNMP_Bind_Unsigned_Integer(P, I, C, \
                                                        L, VT_TIMETICKS, V)

#define SNMP_Bind_Opaque(P,I,C,L,W,S,D) SNMP_Bind_String(P, I, C, L, \
                                                        VT_OPAQUE, W, S, D)

#define VBL_Bind_Counter(P,I,C,L,V)     VBL_Bind_Unsigned_Integer(P, I, C, \
                                                           L, VT_COUNTER, V)

#define VBL_Bind_Gauge(P,I,C,L,V)       VBL_Bind_Unsigned_Integer(P, I, C, \
                                                        L, VT_GAUGE, V)

#define VBL_Bind_Timeticks(P,I,C,L,V)   VBL_Bind_Unsigned_Integer(P, I, C, \
                                                        L, VT_TIMETICKS, V)

#define VBL_Bind_Opaque(P,I,C,L,W,S,D)  VBL_Bind_String(P, I, C, L, \
                                                        VT_OPAQUE, W, S, D)

/* Defined to clean up an SNMP_ERROR in some versions of Emissary */
#define SNMP_Bind_OBJECT_ID             SNMP_Bind_Object_ID


/* We only install some functions if their types are installed */
#if (ENVOY_USE_V2_TYPES)
#define SNMP_Bind_Counter64(P,I,C,L,H,LO) SNMP_Bind_64_Unsigned_Integer(P, I,\
                                                C, L, VT_COUNTER64, H, LO)
#define VBL_Bind_Counter64(P,I,C,L,H,LO) VBL_Bind_64_Unsigned_Integer(P, I,\
                                                C, L, VT_COUNTER64, H, LO)
#endif

#if (INSTALL_ENVOY_SNMP_VERSION_3)
extern  SNMP_PKT_T * SNMP_Create_Request_V3_Lockable __((int, int, bits32_t,
                                                         bits32_t, bits8_t, 
                                                         bits32_t, bits8_t *, 
                                                         ALENGTH_T, bits8_t *,
                                                         ALENGTH_T, bits8_t *,
                                                         ALENGTH_T, bits8_t *,
                                                         ALENGTH_T, sbits32_t,
                                                         int, int, int, int));
extern  SNMP_PKT_T * SNMP_Create_Request_V3 __((int, int, bits32_t,
                                                bits32_t, bits8_t, bits32_t,
                                                bits8_t *, ALENGTH_T,
                                                bits8_t *, ALENGTH_T,
                                                bits8_t *, ALENGTH_T,
                                                bits8_t *, ALENGTH_T,
                                                sbits32_t, int, int, int));
#endif

extern  SNMP_PKT_T *    SNMP_Create_Request2    __((int, int, int, char *,
                                                    INT_32_T, int, int, int));
#define SNMP_Create_Request(PDU, VER, CLEN, CSTR, RID, VBS) \
        SNMP_Create_Request2(PDU, VER, CLEN, CSTR, RID, VBS, 0, 0)

extern SNMP_PKT_T *SNMP_Create_Internal_Request __((int, int, int, sbits8_t *,
                                                    unsigned short int,
                                                    INT_32_T, int, int, int,
                                                    ALENGTH_T, IO_COMPLETE_T *,
                                                    ERR_COMPLETE_T *, PTR_T));

extern  SNMP_PKT_T *    SNMP_Create_Trap        __((int, int, char *, int,
                                                    OIDC_T *, OCTET_T *, int,
                                                    INT_32_T, UINT_32_T, int));

extern  int     SNMP_Bind_Integer          __((SNMP_PKT_T *, int, int,
                                               OIDC_T *, INT_32_T));
extern  int     SNMP_Bind_Unsigned_Integer __((SNMP_PKT_T *, int, int, 
                                               OIDC_T *, OCTET_T, UINT_32_T));
extern  int     SNMP_Bind_IP_Address       __((SNMP_PKT_T *, int, int,
                                               OIDC_T *, OCTET_T *));
extern  int     SNMP_Bind_Object_ID        __((SNMP_PKT_T *, int, int,
                                               OIDC_T *, int, OIDC_T *));
extern  int     SNMP_Bind_String           __((SNMP_PKT_T *, int, int,
                                               OIDC_T *, OCTET_T,
                                               int, OCTET_T *, int));
extern  int     SNMP_Bind_Null          __((SNMP_PKT_T *, int, int, OIDC_T *));

extern  int     VBL_Bind_Integer           __((VBL_T *, int, int,
                                               OIDC_T *, INT_32_T));
extern  int     VBL_Bind_Unsigned_Integer __((VBL_T *, int, int, 
                                              OIDC_T *, OCTET_T, UINT_32_T));
extern  int     VBL_Bind_IP_Address        __((VBL_T *, int, int,
                                               OIDC_T *, OCTET_T *));
extern  int     VBL_Bind_Object_ID         __((VBL_T *, int, int,
                                               OIDC_T *, int, OIDC_T *));
extern  int     VBL_Bind_String    __((VBL_T *, int, int,
                                       OIDC_T *, OCTET_T,
                                       int, OCTET_T *, int));
extern  int     VBL_Bind_Null           __((VBL_T *, int, int, OIDC_T *));

/* We only install some functions if their types are installed */
#if (ENVOY_USE_V2_TYPES)
extern  int     SNMP_Bind_64_Unsigned_Integer __((SNMP_PKT_T *, int, int,
                                                  OIDC_T *, OCTET_T,
                                                  UINT_32_T, UINT_32_T));

extern  int     VBL_Bind_64_Unsigned_Integer __((VBL_T *, int, int,
                                                 OIDC_T *, OCTET_T,
                                                 UINT_32_T, UINT_32_T));
#endif

#ifdef __cplusplus
}
#endif

#endif  /* buildpkt_inc */

